package whisper.service.monitor.repository.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import whisper.service.monitor.repository.RoadPointDataRepository;

/**
 * Created by JT on 2017/9/28.
 */
@Repository
public class RoadPointDataRepositoryImpl implements RoadPointDataRepository {

    private static final String TABLE_NAME_ROADPOINT_DATA = "defeng_road_point";

    @Autowired
    @Qualifier(value = "ali.information_us")
    private JdbcTemplate aliJdbcTemplate;

    @Override
    public String findCountByIssueTime(String issuetime) {
        String sql = String.format("SELECT COUNT(1) FROM %s WHERE ISSUETIME = ?", TABLE_NAME_ROADPOINT_DATA);
        Object[] params = new Object[] {issuetime};
        return aliJdbcTemplate.queryForObject(sql, params, String.class);
    }
}
